import { Component, OnInit } from '@angular/core';
import { DataReportService } from '../../service/http/date-report.service';

@Component({
  selector: 'app-statistics',
  templateUrl: './statistics.component.html',
  styleUrls: ['./statistics.component.less']
})
export class StatisticsComponent implements OnInit {

    appEchartsData: any;
    type: string = "1";
    constructor(private instructionHttpService: DataReportService) {}

    ngOnInit(): void {
        this.getEchartsData();
    }

    getEchartsData() {
        this.appEchartsData = null;
        let params = {
            type: this.type,
        };
        this.instructionHttpService.getInstructionStatistics(params).subscribe(
            (res: any) => {
                if (res.status === 200) {
                    this.appEchartsData = {
                        legend:["跨境通信网络通联","跨境通信访问分析"],
                        date:res.data.result.date,
                        seriesFirst:res.data.result.communication,
                        seriesSecond:res.data.result.analysis,
                    };
                }
            },
            (err: any) => {
                console.log(err);
            }
        );
    }

}
